// src/components/NotFound.js
import React, { useEffect } from 'react';
import { Button } from 'antd';
import useStore from './useStore.js';
import { useHistory } from 'react-router-dom';
import notfound from '../images/notfound.svg'

const NotFound = () => {
  const { collapsed, setnowroute } = useStore();
  const history = useHistory();
  const handleClick = () => {
    setnowroute({ route: '/shipSRM/mainpage', title: '首页' })
    history.push('/shipSRM/mainpage')
  }
  return (
    <div
      style={{
        height: "100%", backgroundColor: `#F1F1F1`, position: "absolute", top: 0, left: 0,zIndex: 9999,
        backgroundSize: "100% 100%", width: "100%",  fontSize: "0.8rem"
      }}>
      <div style={{ width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
        <img src={notfound} alt="404" style={{ width: '30%', height: '30%' }} />
        <div style={{ fontSize: '1.5rem', fontWeight: 600, marginBottom: '1rem', textAlign: 'center' }}>
            抱歉，你访问的页面不存在或无权访问
            <br />
            <Button type="primary" onClick={()=>{handleClick()}}>返回首页</Button>
        </div>
      </div>
    </div>
  );
};

export default NotFound;